ImageGear Professional > User Guide > Using ImageGear > Loading and Saving Images > Format Filter Utility Functions > Getting Information about a File Format Filter |
To get information about an ImageGear format filter use the IG_fltr_info_get() function. It returns information about the features supported by ImageGear for this file format (as IG_FLTR_ flags), the short and full names of the filter's file format and the names of the default file's extension:
Copy Code
|
|
---|---|
nErrCount = [lpfn]IG_fltr_info_get( nFormat, &dwFlags, szShortName, sizeof(szShortName), szFullName, sizeof(szFullName), szDefExt, sizeof(szDefExt) ); |
Together with this function, you can use the IG_fltr_formatlist_sort() function to sort file formats in alphabetic order based on the short name returned by the IG_fltr_info_get() function through its third lpShortNameparameter.
If you want to determine the list of filters that support the IG_FLTR_ features you can use the function:
Copy Code
|
|
---|---|
IG_fltr_formatlist_get(DWORD dwFlags, LPAT_MODE lpFormatList, UINT nFListSize, LPUINT lpnFListCount) |
Through the dwFlagsargument, you can specify any combination of features (for instance, IG_FLTR_DETECTSUPPORT | IG_FLTR_PAGEREADSUPPORT | IG_FLTR_MPAGEREADPSUPPORT), and a list of filters that support those features will be returned through the second parameter (lpFormatList). See the description of this function in the Core Component API Function Reference for detailed information about the parameters. If you want to determine the value of the nFListSizeargument, first set lpFormatListto NULL. You can also use this function together with IG_fltr_formatlist_sort() to get the list of filters that support necessary features and sort them by filter name:
Copy Code
|
|
---|---|
UINT nFilterSize; UINT nFListSize; LPAT_MODE FList = NULL; LPCHAR lpFilter = NULL; LPSTR str; IG_fltr_formatlist_get( IG_FLTR_PAGEREADSUPPORT, NULL, 0, &nFListSize ); FList = malloc( nFListSize*sizeof(AT_MODE) ); if( FList!=NULL ) { IG_fltr_formatlist_get( IG_FLTR_PAGEREADSUPPORT, FList, nFListSize, NULL ); IG_fltr_formatlist_sort( FList, nFListSize ); ... } |
You can get information about any page of a multi-page file without loading it into memory if you use the function IG_fltr_pageinfo_get(). Return information consists of the name of the file format (as IG_FORMAT_ constant), the type of image compression (as IG_COMPRESSION_ constant), and such info as bpp, width and height of the page-image.
Another two IG_fltr_...() functions allow you to work with pages in a multi-page file without loading it in memory:
Copy Code
|
|
---|---|
IG_fltr_pageswap_file (const LPSTR lpszFileName, AT_MODE nFormatType, UINT Page1, UINT Page2) IG_fltr_pagedelete_file (const LPSTR lpszFileName, AT_MODE nFormatType, UINT nStartPage, UINT nRange) |
Both functions accept the filename of the multi-page image, format filter ID, and two integer parameters as page numbers (assuming numeration from 1). The first function swaps pages in a multi-page image specified by page numbers, but the second function deletes pages from it.
Before using these functions you have to determine whether or not ImageGear supports the corresponding features for the necessary file format. This can be done using the function IG_fltr_info_get() and inspecting flags returned through the second parameter for the specified file formats. If this value contains the flag IG_FLTR_PAGESWAPSUPPORT, then the format filter does support the IG_fltr_pageswap_file() operation. If it also has the flag IG_FLTR_PAGEDELETESUPPORT, then it supports the IG_fltr_pagedelete_file() operation.
SWAP and DELETE operations may or may not physically reorder multi-page files. For example, the page delete operation may not really reduce the size of the file - just update the file format structures and remove the specified pages from it. |